#ifndef __MCPERPENDICULARCONSTRAINT_H_
#define __MCPERPENDICULARCONSTRAINT_H_

#include <MCConstraint.h>
#include <MCSegmentVisual.h>
#include <cg_api.h>
#include <cg_geometric_api.h>

class MCPerpendicularConstraintVisual;

class MCPerpendicularConstraint : public MCConstraint
{
public:

    MCPerpendicularConstraint(MCSegmentVisual *s1, MCSegmentVisual *s2);
    ~MCPerpendicularConstraint();

    void resolve() override;

public:

    MCSegmentVisual *_segment1;
    MCSegmentVisual *_segment2;

private:

    void makeOrthogonal(MCVector2 &vec1, MCVector2 &vec2);

private:

    MCPerpendicularConstraintVisual *_visual;

    MCVector2 _rootDir1;
    MCVector2 _rootDir2;

    cg::Solver _solver;
};

#endif // !__MCPERPENDICULARCONSTRAINT_H_